package tr.edu.ege.kipler.satisfiability.container.operational;

import java.util.Comparator;

import tr.edu.ege.kipler.satisfiability.container.Individual;
import tr.edu.ege.kipler.satisfiability.container.SHOIQIndividual;

/**
 * 
 * @author İnanç Seylan
 *
 */
public class SHOIQIndividualComparator implements Comparator<Individual> {

	public int compare(Individual arg0, Individual arg1) {
		SHOIQIndividual indv0 = (SHOIQIndividual) arg0;
		SHOIQIndividual indv1 = (SHOIQIndividual) arg1;
		int result = indv0.getLevel() - indv1.getLevel();
		if (result == 0 && !indv0.equals(indv1)) {
			result = indv0.getName().compareTo(indv1.getName());
		}
		return result;
	}

}
